package cn.wolfcode.p2p.base.domain;

import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Setter
@Getter
public class AuditBaseDomain extends BaseDomain {
    //认证状态
    public static final int AUTH_WAIT = 0;
    public static final int AUTH_SUCCESS = 1;
    public static final int AUTH_REFUSE = 2;
    public static final int AUTH_CANCEL = 3;

    /**
     * 状态
     */
    protected Integer state = AUTH_WAIT;

    /**
     * 备注
     */
    protected String remark;
    /**
     * 审核通过时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    protected Date auditTime;
    /**
     * 申请审核时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    protected Date applyTime;

    /**
     * 审核人
     */
    protected LoginInfo auditor;

    /**
     * 申请人
     */
    protected LoginInfo applier;

    /**
     * 认证状态
     */
    public String getStateName() {
        switch (state) {
            case AUTH_WAIT:
                return "申请中";
            case AUTH_SUCCESS:
                return "审核通过";
            case AUTH_REFUSE:
                return "审核拒绝";
            case AUTH_CANCEL:
                return "用户取消";
        }
        return "审核状态异常";
    }


}
